package com.mobimap.nhom9.dao.table;

import android.database.Cursor;

import com.mobimap.nhom9.dto.LocationDTO;
import com.mobimap.nhom9.dto.NodeInfoDTO;

public class NodeInfoTable implements IOneKeyTable<NodeInfoDTO> {

	public final String[] columns = new String[] { "ID", "xLocation",
			"yLocation" };

	public String getName() {

		return "NodeInfo";
	}

	public String[] getColumns() {

		return columns;
	}

	public NodeInfoDTO cusorToDTO(Cursor cursor) {
		NodeInfoDTO dto = new NodeInfoDTO();
		dto.setId(cursor.getInt(0));
		LocationDTO location = new LocationDTO();
		location.setLatitude(cursor.getDouble(1));
		location.setLongitude(cursor.getDouble(2));
		dto.setLocation(location);
		return dto;
	}

	public String getColumnKey() {

		return "ID";
	}
}
